package com.kitchen.api.controller;

import com.kitchen.common.vo.ResultVO;
import com.kitchen.beans.entity.Comment;
import com.kitchen.service.CommentService;
import com.kitchen.beans.vo.CommentVo;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/comment")
@Api(value = "提供用户的评论接口",tags = "评论管理")
public class CommentController {
    @Autowired
    CommentService commentService;
    @RequestMapping(value = "/commentlist",method = RequestMethod.POST)
    public ResultVO commentlist(@RequestBody CommentVo commentvo){
        ResultVO resultVO = commentService.listComment(commentvo);
        return resultVO;
    }
    @RequestMapping(value = "/commentadd",method = RequestMethod.POST)
    public ResultVO commentadd(@RequestBody Comment comment){
        ResultVO resultVO = commentService.Commentadd(comment);
        return resultVO;
    }
    @RequestMapping(value = "/answer",method = RequestMethod.POST)
    public ResultVO commentanswer(@RequestBody Comment comment){
        ResultVO resultVO = commentService.Commentanswer(comment);
        return resultVO;
    }
    @RequestMapping(value = "/commentdelete",method = RequestMethod.POST)
    public ResultVO commentdelete(@RequestBody Comment comment){
        ResultVO resultVO = commentService.Commentdelete(comment);
        return resultVO;
    }
    @RequestMapping(value = "/praise",method = RequestMethod.POST)
    public ResultVO commentpraise(@RequestBody CommentVo commentVo){
        ResultVO resultVO = commentService.Commentpraise(commentVo);
        return resultVO;
    }

}
